UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'v/jhtyYDMsJuQb37l/si4cgFD95zB1cpr1sELWIr+bA=' 
WHERE 
  key_id = 'c05a5a723ec21affe552b3f7a76dfd161400c68cbf195cc8236364a06d1ef979' 
  AND (
    token = 'v/jhtyYDMsJuQb37l/si4cgFD95zB1cpr1sELWIr+bA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028