UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CsAnNL1y0ZsHxjebZix5zcRm4LqvGrE24LKF8mZ1klE=' 
WHERE 
  key_id = '593c4576246e9a74f3a70751aaad0e57b23cdc920ea7041011db1194104ff7bc' 
  AND (
    token = 'CsAnNL1y0ZsHxjebZix5zcRm4LqvGrE24LKF8mZ1klE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00056