UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DhB4X4apGh2lDn8bKGwXZpawvWTYLDVsrNPR5xX7daM=' 
WHERE 
  key_id = '4eba39a4fb2280749d4289764c1cc1aee2ca607d4a02be4244b94ee780844306' 
  AND (
    token = 'DhB4X4apGh2lDn8bKGwXZpawvWTYLDVsrNPR5xX7daM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00082